Component({
  properties: {
    visible: {
      type: Boolean,
      value: false
    },
    placeholder: String,
    showPrefixIcon: {
      type: Boolean,
      value: true
    }
  },

  data: {
    value: ''
  },

  methods: {
    hide: function () {
      this.setData({
        'visible': false
      })
    },
    handleInput: function ({ detail: { value } }) {
      const v = value.trimLeft()
      this.setData({
        value: v
      })
      return v
    },
    handleConfirm: function () {
      if (this.data.value !== '') {
        this.triggerEvent('submit', this.data.value)
      }
    }
  }
})